package Java4_10;

import java.util.ArrayList;
import java.util.List;

public class Java2 {
	private String ming;
	private String id;
	private int dian;
	private String fan;
	List<Java_2> s = new ArrayList<Java_2>();

	public void in() {
		s.add(new Java_2("小明", 12, "男", "经理", 500, 1));
		s.add(new Java_2("小红", 22, "男", "文员", 400, 2));
	}

	public Java2(String ming, String id, int dian, String fan) {
		super();
		this.ming = ming;
		this.id = id;
		this.dian = dian;
		this.fan = fan;
	}

	// 删除
	public boolean is(int a) {
		for (Java_2 q : s) {
			if (q.getGong() == a) {
				return s.remove(q);
			}
		}
		return false;
	}

	// 添加
	public boolean add(String name, int age, String exe, String zhi, int xin, int gong) {
		if (s.add(new Java_2(name, age, exe, zhi, xin, gong))) {
			return true;
		}
		return false;
	}

	public void show1() {
		System.out.println("公司名称:" + ming + "\t注册地址:" + id + "\t电话:" + dian + "\t范围:" + fan);
	}

	// 显示
	public void show() {
		System.out.println(s);
	}

	// 人数
	public int sum() {
		return s.size();
	}

	// 加薪
	public void find(Object o) {
		Collections.sort(s);
		Java_2 max = (Java_2) s.get(s.size() - 1);
		max.setXin(max.getXin() + 1000);
		System.out.println("加薪成功");
	}
}
